
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       sensor_baro_spl06.h
  * @author     baiyang
  * @date       2022-5-31
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/
#include "sensor_baro.h"
#include "sensor_baro_backend.h"

#include <device_manager/dev_mgr.h>
/*-----------------------------------macro------------------------------------*/
#ifndef HAL_BARO_SPL06_I2C_ADDR
 #define HAL_BARO_SPL06_I2C_ADDR  (0x76)
#endif

#ifndef HAL_BARO_SPL06_I2C_ADDR2
 #define HAL_BARO_SPL06_I2C_ADDR2 (0x77)
#endif
/*----------------------------------typedef-----------------------------------*/
typedef struct {
    sensor_baro_backend backend;

    gp_device_t _dev;

    int8_t _timer_counter;
    uint8_t _instance;
    float _temp_raw;
    float _pressure_sum;
    uint32_t _pressure_count;
    float _temperature;

    // Internal calibration registers
    int32_t _c00, _c10;
    int16_t _c0, _c1, _c01, _c11, _c20, _c21, _c30;
    
} sensor_baro_spl06;

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/
void sensor_baro_spl06_ctor(sensor_baro_spl06 *spl06, gp_device_t dev);
sensor_baro_backend *sensor_baro_spl06_probe(gp_device_t dev);
/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



